#pragma once

#include "NeroGame\NGameEntity.h"
#include "Device.h"
namespace Graphics
{
	class Model;
}

namespace Graphics
{
class RenderableEntity : public Game::NGameEntity
{
public:
	RenderableEntity(void);
	virtual ~RenderableEntity(void);
	virtual void Render();
	virtual void Update(float deltaTime);

	D3DXMATRIX& GetViewMatrix();

	void SetDirection(const D3DXVECTOR3& direction){mDirection = direction;}
	void SetPosition(const D3DXVECTOR3& position){mPosition = position;}
	void SetOrientation(const D3DXVECTOR3& orientation){mOrientation = orientation;}
	void SetRight(const D3DXVECTOR3& right){mRight = right;}
	void SetScale(float scale){mScale = scale;}

	void UpdateMaterial();
	void UpdateWorldMatrix();

	Graphics::Model* GetModel();
	void Rotate(D3DXVECTOR3 amount);

	virtual int GetIndexCount();
protected:
	void ApplyTransform(const D3DXMATRIX& transform);

protected:
	D3DXVECTOR3 mDirection;							//!<
	D3DXVECTOR3 mOrientation;						//!<
	D3DXVECTOR3 mPosition;							//!<
	D3DXVECTOR3 mRight;								//!<
	D3DXVECTOR3 mRotation;
	float mScale;									//!<

	D3DXMATRIX mScaleMatrix;
	D3DXMATRIX mWorld;								//!<
	D3DXMATRIX mWorldViewProjection;				//!<

	Graphics::Model* mModel;
	
};
}